import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)
// 引入自定义主题文件
import {autoFun} from "@/utils/autoTheme.js";
// console.log(autoFun);


export default new Vuex.Store({
  state: {
    themeName:'vintage',  //设置主题状态
    autoThemes:autoFun('dark')
  },
  mutations: {
    // 修改主题
    changeTheme(state,newV){
      // 切换echarts主题
      state.themeName = state.themeName == "dark" ? 'vintage' : 'dark';
      // 同步自定义主题
      state.autoThemes = autoFun(state.themeName)
      // console.log(state.autoThemes);
    }
  },
})
